<script>
import {zwappid,appname,socketurl} from '@/common/config'
import aplus from '@/common/aplus'
import { appConfig } from '@/utils/http'

export default {
	globalData:{
		config:''
	},
	onLaunch: function(e) {
		console.log('==========onLaunch============',e.query.ticket)
		let app_type = this.apptype();
		if(app_type != 'h5'){
			this.setJsBridge();
		}
		// this.login.isLogin();
		// console.log('ticket:')
		// console.log(this.getQueryVariable('ticket'))
		if(location.href.indexOf('ticket')==-1){
			this.login.isLogin();
		}
	},
	methods:{
		setJsBridge(){
			ZWJSBridge.onReady(() => {
				console.log('初始化完成后，执⾏bridge⽅法')
			})
			let userType = null;
			let long = null;
			let lati = null;
			let address = null;
			//应用开发管理平台-应用 ID
			const appid = zwappid;
			
			ZWJSBridge.getUserType()
				.then((result) => {
					userType = result.userType;
				}).catch((error) => {
					console.log(error);
				});
			ZWJSBridge.getLocation().then((result) => {
				console.log('ZWJSBridge.getLocation',result)
				if(result.success){
					long = result.longitude
					lati = result.latitude
					address = result.detailAddress
					uni.setStorageSync('long',long)
					uni.setStorageSync('lati',lati)
					uni.setStorageSync('address',address)
					aplus.block()
					aplus.setinfomat(userType,appid,appname,long,lati);
				}
			}).catch((error) => {
				console.log(error);
			});
			//设置样式
			ZWJSBridge.getUiStyle({})
			.then((result) => {   
				switch(result.uiStyle) {
					case 'normal':
						//setUiStyle('标准模式');
						require('@/common/font1.css')
					break;
					case 'elder':
						require('@/common/font2.css')
					break;
					default:
						require('@/common/font1.css')
				} 
				console.log(result); 
			})
			//浙里办APP 6.11.0 版本以下版本标准模式兼容
			.catch((error) => { setUiStyle('catch 标准模式兼容');  console.log(error); });
		},
		//客户端类型
		apptype(){
			let app_type = null
			const sUserAgent = window.navigator.userAgent.toLowerCase()
			console.log('sUserAgent',sUserAgent)
			// const bIsDtDreamApp = sUserAgent.indexOf('dtdreamweb') > -1 // 浙里办APP
			// const bIsAlipayMini =     sUserAgent.indexOf('miniprogram') > -1 && sUserAgent.indexOf('alipay') > -1
			if (sUserAgent.indexOf('dtdreamweb') > -1) {
				app_type = 'zwapp'
			} else if ( sUserAgent.indexOf('miniprogram') > -1 && sUserAgent.indexOf('alipay') > -1 ) {
				app_type = 'alipay'
			} else if ( sUserAgent.match(/MicroMessenger/i) == 'micromessenger' ) {
				app_type = 'wxapp'
			} else {
				app_type = 'h5'
			}
			console.log('app_type',app_type)
			uni.setStorageSync('app_type', app_type)
			return app_type
		},
	}
}
</script>

<style>
/*每个页面公共css */
@import url('./common/style.css');
@import url('./common/iconfont.css');
img{
	max-width:100% !important;height:auto;display:block;margin:0px auto;
}
.line13{
	line-height: 1.3em;
}
.line15{
	line-height: 1.5em;
}
.uni-audio-time{
	float: left !important;
	margin-right: 10px !important;
}
.uni-audio-default{
	display: block !important;
}
.uni-audio-info{
	margin-right: 0px !important;
}
.uni-audio{
	display: block !important;
}
.uni-audio[controls]{
	display: block !important;
}
.banner {
	border-radius: 5px;
}
.banner-item {
	border-radius: 5px;
	text-align: center;
	width: 100%;
}

.district .dis-icon{
	height: 100rpx;
	width: 100rpx;
	text-align: center;
}
.ad-content .ad-poster{
	height: 90px;
	width: 100%;
	/* background-image: linear-gradient(#FF7D27, #FFAF50); */
	border-radius: 40px
}
.banner-box{
	box-shadow: 0px 1px 1px 1px rgba(0,0,0,0.1);
	overflow: hidden;
	border-radius: 10px;
}
.uni-swiper{
	max-height: 130px !important;
}
/* html{
  font-size: 10px !important;
  min-height: 100%;
  font-family: monospace;
}
page {
	min-height: 100%;
	width: 100%;
	display: flex;
	flex-direction: column;
}
.page{
	width: 100%;
	display: flex;
	flex-direction: column;
	flex: 1;
} */
.tipText{
	margin-top: 100px;
}
.footer {
	margin: auto;
	margin-top: 30rpx;
	width: 220px;
	height: 43px;
	line-height: 43px;
	color: #fff;
	background-color: #0088ff;
	border-radius: 5px;
}
/* // loading css */
.loadingBox{
	.loading{
		width: 100%;
		height: 102rpx;
	}
	.spinner {
	  width: 60px;
	  height: 60px;
	  background-color: #3B97FF;
	 
	  margin: 100px auto;
	  -webkit-animation: rotateplane 1.2s infinite ease-in-out;
	  animation: rotateplane 1.2s infinite ease-in-out;
	}
	 
	@-webkit-keyframes rotateplane {
	  0% { -webkit-transform: perspective(120px) }
	  50% { -webkit-transform: perspective(120px) rotateY(180deg) }
	  100% { -webkit-transform: perspective(120px) rotateY(180deg)  rotateX(180deg) }
	}
	 
	@keyframes rotateplane {
	  0% {
		transform: perspective(120px) rotateX(0deg) rotateY(0deg);
		-webkit-transform: perspective(120px) rotateX(0deg) rotateY(0deg)
	  } 50% {
		transform: perspective(120px) rotateX(-180.1deg) rotateY(0deg);
		-webkit-transform: perspective(120px) rotateX(-180.1deg) rotateY(0deg)
	  } 100% {
		transform: perspective(120px) rotateX(-180deg) rotateY(-179.9deg);
		-webkit-transform: perspective(120px) rotateX(-180deg) rotateY(-179.9deg);
	  }
	}
}
.maskTop{
	position: absolute;
	top: 0;
	width: 100%;
	height: 50px;
	background-image: linear-gradient(to bottom, rgb(255, 255, 255), transparent);
	/* background-color:#fff;filter:Alpha(Opacity=60);opacity:0.6; */
	z-index: 2;
}
.maskBottom{
	position: absolute;
	bottom: 0;
	width: 100%;
	height: 50px;
	background-image: linear-gradient(to top, rgb(255, 255, 255), transparent);
	/* background-color:#fff;filter:Alpha(Opacity=60);opacity:0.6; */
	z-index: 2;
}
p{
	text-align: justify;
	letter-spacing: 4rpx;
	line-height: 1.5em;
}
section span{
	text-align: justify;
	letter-spacing: 4rpx;
	line-height: 1.5em;
}
.articleBox{
	padding-left: 36rpx;
	padding-right: 36rpx;
}
.articleBox img{
	margin-top: 20rpx !important;
	margin-bottom: 20rpx !important;
}
.p img{
	margin-top: 20rpx !important;
	margin-bottom: 20rpx !important;
}
</style>
